﻿using System;

namespace Functions
{
    class Program
    {
        static void Main(string[] args)
        {
            //long a = 2 + 5;
            long a = Add(2, 5);

            DoWork();
        }

        static void DoWork()
        {
            int[] negativeArray = GetRandomArray(100, -100, 0);
            int[] positiveArray = GetRandomArray(100, 0, 101);

            long negSum = GetArraySum(negativeArray);
            long posSum = GetArraySum(positiveArray);

            long[] sum = GetArraysSum(negativeArray, positiveArray);
        }

       

        /// <summary>
        /// Generates an array of random numbers
        /// </summary>
        /// <param name="length">Length of array</param>
        /// <param name="min">Min bound of random numbers</param>
        /// <param name="max">Max bound of random numbers</param>
        /// <returns>Array of random numbers</returns>
        static int[] GetRandomArray(int length, int min, int max)
        {
            Random rnd = new Random();

            int[] array = new int[length];
            
            for (int i = 0; i < length; i++)
            {
                array[i] = rnd.Next(min, max);
            }

            return array;
        }


        static long GetArraySum(int[] array)
        {
            long sum = 0;
            for (int i = 0; i < array.Length; i++)
            {
                sum += array[i];
            }
            return sum;
        }

        static long[] GetArraysSum(int[] a, int[] b)
        {
            int n = a.Length;
            long[] sum = new long[n];

            for (int i = 0; i < n; i++)
            {
                sum[i] = a[i] + b[i];
            }

            return sum;
        }

        /// <summary>
        /// This functions add two integer numbers
        /// </summary>
        /// <param name="a">integer number</param>
        /// <param name="b">integer number</param>
        /// <returns>sum of two numbers</returns>
        static long Add(int a, int b)
        {
            long c = a + b;
            return c;
        }
    }
}
